package com.Ajava1704.for设计模式.for单例模式;

import com.coreJava.test02.MyCycRunable;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * 作者: LCG
 * 日期: 2020/2/14 15:20
 * 描述:
 */
public class Test009 {

    public static void main(String[] args) throws InterruptedException, ExecutionException, IOException {



        CountDownLatch countDownLatch=new CountDownLatch(4);

        FutureTask f1=new FutureTask(new MyCallable(countDownLatch));
        Thread t1=new Thread(f1);
        t1.start();

        FutureTask f2=new FutureTask(new MyCallable(countDownLatch));
        Thread t2=new Thread(f2);
        t2.start();

        FutureTask f3=new FutureTask(new MyCallable(countDownLatch));
        Thread t3=new Thread(f3);
        t3.start();

        FutureTask f4=new FutureTask(new MyCallable(countDownLatch));
        Thread t4=new Thread(f4);
        t4.start();

        countDownLatch.await();
        Object o1 = f1.get();
        Object o2 = f2.get();
        Object o3 = f3.get();
        Object o4 = f4.get();
        System.out.println(o1==o2);
        System.out.println(o1==o3);
        System.out.println(o1==o4);


        ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream();
        ObjectOutputStream objectOutputStream=new ObjectOutputStream(byteArrayOutputStream);



    }

}
